package com.hook3.pianke.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;

import com.hook3.pianke.R;

/**
 * Created by chai on 2015/12/10.
 * 登录注册页面
 */
public class RegisterActivity extends Activity {
    private ImageView login_left_iv;
    private TextView activity_tv_register;
    private EditText login_email_et;
    private EditText login_password_et;
    private TextView login_forget_password_tx;
    private Button login_btn;
    private ImageButton activity_sina_button;
    private ImageButton activity_qq_button;
    private ImageButton activity_douban_button;
    private ImageButton activity_renren_button;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        initView();//初始化数据
    }

    /**
     * 初始化数据
     */
    private void initView() {
        login_left_iv = (ImageView) findViewById(R.id.login_left_iv);
        activity_tv_register = (TextView) findViewById(R.id.activity_tv_register);
        login_email_et = (EditText) findViewById(R.id.login_email_et);
        login_password_et = (EditText) findViewById(R.id.login_password_et);
        login_forget_password_tx = (TextView) findViewById(R.id.login_forget_password_tx);
        login_btn = (Button) findViewById(R.id.login_btn);
        activity_sina_button = (ImageButton) findViewById(R.id.activity_sina_button);
        activity_qq_button = (ImageButton) findViewById(R.id.activity_qq_button);
        activity_douban_button = (ImageButton) findViewById(R.id.activity_douban_button);
        activity_renren_button = (ImageButton) findViewById(R.id.activity_renren_button);


        //设置监听
        login_left_iv.setOnClickListener(new MyReqisterOnClickLayout());
        activity_tv_register.setOnClickListener(new MyReqisterOnClickLayout());
        login_forget_password_tx.setOnClickListener(new MyReqisterOnClickLayout());
        login_btn.setOnClickListener(new MyReqisterOnClickLayout());
        activity_sina_button.setOnClickListener(new MyReqisterOnClickLayout());
        activity_qq_button.setOnClickListener(new MyReqisterOnClickLayout());
        activity_douban_button.setOnClickListener(new MyReqisterOnClickLayout());
        activity_renren_button.setOnClickListener(new MyReqisterOnClickLayout());


    }

    private class MyReqisterOnClickLayout implements View.OnClickListener {
        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.login_left_iv://返回
                    finish();

                    break;
                case R.id.activity_tv_register://注册
                    Intent intent = new Intent(RegisterActivity.this,LoginActivity.class);
                    startActivity(intent);

                    break;

                case R.id.login_forget_password_tx://忘记密码
                    Toast.makeText(RegisterActivity.this,"忘记密码",Toast.LENGTH_SHORT).show();

                    break;
                case R.id.login_btn://登录
                    Toast.makeText(RegisterActivity.this,"登录",Toast.LENGTH_SHORT).show();

                    break;
                case R.id.activity_sina_button://使用新浪账户关联
                    Toast.makeText(RegisterActivity.this,"使用新浪账户关联",Toast.LENGTH_SHORT).show();

                    break;
                case R.id.activity_qq_button://使用qq账户关
                    Toast.makeText(RegisterActivity.this,"使用qq账户关",Toast.LENGTH_SHORT).show();


                    break;
                case R.id.activity_douban_button://使用豆瓣账户关联
                    Toast.makeText(RegisterActivity.this,"使用豆瓣账户关联",Toast.LENGTH_SHORT).show();

                    break;
                case R.id.activity_renren_button://使用人人账户关联
                    Toast.makeText(RegisterActivity.this,"使用人人账户关联",Toast.LENGTH_SHORT).show();

                    break;

                default:
                    break;
            }
        }
    }
}
